package sf01.studentmngmsystem.entity;

import lombok.Data;
import jakarta.validation.constraints.*;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
public class Student {
    private Long id;
    
    // 移除@NotBlank注解，保留格式验证（可选）
    @Pattern(regexp = "^[0-9]{8,12}$", message = "学号格式不正确")
    private String studentNumber;
    
    // 移除@NotBlank注解，保留长度验证（可选）
    @Size(min = 6, max = 20, message = "密码长度必须在6-20个字符之间")
    private String password;
    
    @NotBlank(message = "姓名不能为空")
    @Size(min = 2, max = 20, message = "姓名长度必须在2-20个字符之间")
    private String name;
    
    @NotBlank(message = "性别不能为空")
    @Pattern(regexp = "^(男|女)$", message = "性别只能是男或女")
    private String gender;
    
    @Past(message = "出生日期必须是过去的日期")
    private LocalDate birthDate;
    
    @PastOrPresent(message = "入学日期不能是未来日期")
    private LocalDate enrollmentDate;
    
    @NotBlank(message = "专业不能为空")
    @Size(min = 2, max = 50, message = "专业名称长度必须在2-50个字符之间")
    private String major;
    
    @NotBlank(message = "班级编号不能为空")
    @Pattern(regexp = "^[A-Za-z0-9]{2,20}$", message = "班级编号格式不正确")
    private String classNumber;
    
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String phone;
    
    @Email(message = "邮箱格式不正确")
    private String email;
    
    @Size(max = 200, message = "地址长度不能超过200个字符")
    private String address;

    private String avatarPath;
    private String idCardPath;
    private String attachments;
    
    private LocalDateTime createTime;
    private LocalDateTime updateTime;
}
